From 98eec2ce0f0d1c6228bf026313dc9294df8bda66 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Tue, 2 Jan 2018 20:35:32 +0100 Subject: [PATCH] Bump hex to 0.3 --- Cargo.toml | 2 +- src/cargo/sources/directory.rs | 4 ++-- src/cargo/sources/registry/local.rs | 4 ++-- src/cargo/sources/registry/remote.rs | 4 ++-- src/cargo/util/hex.rs | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 912b54469..9152b754d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ fs2 = "0.4" git2 = "0.6" git2-curl = "0.7" glob = "0.2" -hex = "0.2" +hex = "0.3" home = "0.3" ignore = "0.3" jobserver = "0.1.6" diff --git a/src/cargo/sources/directory.rs b/src/cargo/sources/directory.rs index d2db5b08e..8416485b5 100644 --- a/src/cargo/sources/directory.rs +++ b/src/cargo/sources/directory.rs @@ -4,7 +4,7 @@ use std::fs::File; use std::io::Read; use std::path::{Path, PathBuf}; -use hex::ToHex; +use hex; use serde_json; @@ -184,7 +184,7 @@ impl<'cfg> Source for DirectorySource<'cfg> { file.display()) })?; - let actual = h.finish().to_hex(); + let actual = hex::encode(h.finish()); if &*actual != cksum { bail!("\ the listed checksum of `{}` has changed:\n\ diff --git a/src/cargo/sources/registry/local.rs b/src/cargo/sources/registry/local.rs index 5803fd77d..d4d67a229 100644 --- a/src/cargo/sources/registry/local.rs +++ b/src/cargo/sources/registry/local.rs @@ -3,7 +3,7 @@ use std::io::prelude::*; use std::path::Path; use core::PackageId; -use hex::ToHex; +use hex; use sources::registry::{RegistryData, RegistryConfig}; use util::FileLock; use util::paths; @@ -94,7 +94,7 @@ impl<'cfg> RegistryData for LocalRegistry<'cfg> { } state.update(&buf[..n]); } - if state.finish().to_hex() != checksum { + if hex::encode(state.finish()) != checksum { bail!("failed to verify the checksum of `{}`", pkg) } diff --git a/src/cargo/sources/registry/remote.rs b/src/cargo/sources/registry/remote.rs index 489d001b9..a2a0f9402 100644 --- a/src/cargo/sources/registry/remote.rs +++ b/src/cargo/sources/registry/remote.rs @@ -7,7 +7,7 @@ use std::path::Path; use std::str; use git2; -use hex::ToHex; +use hex; use serde_json; use core::{PackageId, SourceId}; @@ -250,7 +250,7 @@ impl<'cfg> RegistryData for RemoteRegistry<'cfg> { })?; // Verify what we just downloaded - if state.finish().to_hex() != checksum { + if hex::encode(state.finish()) != checksum { bail!("failed to verify the checksum of `{}`", pkg) } diff --git a/src/cargo/util/hex.rs b/src/cargo/util/hex.rs index 71a4c112f..16bd16fcd 100644 --- a/src/cargo/util/hex.rs +++ b/src/cargo/util/hex.rs @@ -1,10 +1,10 @@ #![allow(deprecated)] -use hex::ToHex; +use hex; use std::hash::{Hasher, Hash, SipHasher}; pub fn to_hex(num: u64) -> String { - [ + hex::encode(&[ (num >> 0) as u8, (num >> 8) as u8, (num >> 16) as u8, @@ -13,7 +13,7 @@ pub fn to_hex(num: u64) -> String { (num >> 40) as u8, (num >> 48) as u8, (num >> 56) as u8, - ].to_hex() + ]) } pub fn hash_u64(hashable: &H) -> u64 { -- 2.30.2